package com.sznaner.tool.util;


import android.annotation.SuppressLint;
import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.content.Intent;

public class BluetoothUtil {


    public static boolean bluetoothEnabled(){
        BluetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter();
        return bluetooth.isEnabled();
    }

    public static void bluetoothOpen(){

        BluetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter();

        if(bluetooth !=null && !bluetooth.isEnabled()){
            bluetooth.enable();
        }
    }

    public static void bluetoothClose(){

        BluetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter();
        if(bluetooth !=null && bluetooth.isEnabled()){
            bluetooth.disable();
        }
    }

    public static void pauseMusic( ) {
        Intent freshIntent = new Intent();
        freshIntent.setAction("com.android.music.musicservicecommand.pause");
        freshIntent.putExtra("command", "pause");
        NRTool.context().sendBroadcast(freshIntent);
    }

    public static void continuMusic() {
        Intent freshIntent = new Intent();
        freshIntent.setAction("com.android.music.musicservicecommand.togglepause");
        freshIntent.putExtra("command", "togglepause");
        NRTool.context().sendBroadcast(freshIntent);
    }




}
